package ms.maplestory.boot.enums.login;

import java.util.Arrays;

/**
 * 账号权限掩码
 */
public enum GameManagerFlag {

    Normal(0, 0),
    Elite(1, 0),
    Intern(2, 0),
    Gm(3, 0x40),
    SuperGm(4, 0x40),
    Admin(5, 0x80),
    Controller(6, 0x80);

    private int level;
    private byte subGradeCode;

    GameManagerFlag(int level, int subGradeCode) {
        this.level = level;
        this.subGradeCode = (byte) subGradeCode;
    }

    public int getLevel() {
        return level;
    }

    public byte getSubGradeCode() {
        return subGradeCode;
    }

    public static GameManagerFlag getByLevel(int level) {
        return Arrays.stream(values()).filter(p -> p.getLevel() == level).findFirst().orElse(Normal);
    }
}
